﻿
var wcs_debug=false;
var wcs_version="452";

var wcs_load_end=false;
var wcs_default_theme="default";
var wcs_default_layout="default";
var wcs_default_lang="en-us";
var wcs_user_cookie_version="001";

var wcs_context_timeout=365*10*3600*24;

var wcs_net_gw_path="gateway/";
var wcs_net_gw_connect_retry=5;
var wcs_net_gw_disconnect_retry=3;

var wcs_show_focus=true;
var wcs_net_gw_send_retry=5;

var wcs_net_exchange_min_interval=500;
var wcs_net_exchange_max_interval=1000*60*5;

var sd_net_enable=true;
var wcs_icon_size=16;
var wcs_items_per_page=200;
var wcs_items_no_page=100;

var wcs_co_document_interval=1000;
var wcs_co_interval=5000;

var wcs_url="/";
var wcs_root_host="http://r0.haoda35.com/";  //var wcs_root_host="/";   //
var wcs_root=wcs_root_host+"res/";
var wcs_media_root="http://m0.haoda35.com/";  //var wcs_media_root=wcs_root_host;  //
var wcs_site_root="http://m0.haoda35.com/";    //var wcs_site_root=wcs_root_host;   //
var wcs_url_ajax_call="/c";
var _gaq = _gaq || [];
//var allow_domains=[".tap.cn",".37space.com",".37space.cn",".80.com",".81.com",".82.com",".37kj.com",".my.com",".binsir.com",".haoda35.com",".aiymte.com",".fengruiaoshi.com.cn"];
var wcs_allow_domains={ms:{"haoda35.com":1,"80.com":1},ad:[".tap.cn",".37space.com",".37space.cn",".80.com",".81.com",".82.com",".37kj.com",".my.com",".binsir.com"]};

(function(){
	var wv=wcs_vars;
	var w=window;
	var d=document;
	var pt;
	w.now=new Date();
	var ua=navigator.userAgent.toLowerCase();
	var is_ie=ua.indexOf('msie')!=-1;
	var is_ie9=ua.indexOf('msie 9')!=-1;
	var is_ie8=ua.indexOf('msie 8')!=-1;
	var is_ie7=!is_ie8 && ua.indexOf('msie 7')!=-1;
	var is_ie6=!is_ie8 && !is_ie7 && ua.indexOf('msie 6')!=-1;
	var is_sf=ua.indexOf('safari')!=-1;

	if(!is_ie && w.top!=w) d.documentElement.style.overflow='hidden';
	var biz=wcs_vars.user_type=="1"?true:false;
	var now=w.now.valueOf();
	var exp=new Date(now+1000*3600*24);
	var ex=exp.toGMTString();
	ex=ex.substring(0,ex.length-3)+"GMT";
	if(document.cookie.indexOf("uv=")==-1)
		document.cookie="uv="+location.hostname+";expires="+ex;
	function format_date(d,f){var o={"M+":d.getMonth()+1,"d+":d.getDate(),"h+":d.getHours(),"m+":d.getMinutes(),"s+":d.getSeconds()};var week={"0":"\u65e5","1":"\u4e00","2":"\u4e8c","3":"\u4e09","4":"\u56db","5":"\u4e94","6":"\u516d"};var month={"0":"\u4e00","1":"\u4e8c","2":"\u4e09","3":"\u56db","4":"\u4e94","5":"\u516d","6":"\u4E03","7":"\u516B","8":"\u4E5D","9":"\u5341","10":"\u5341\u4E00","11":"\u5341\u4E8C"};var em={"0":"Jan","1":"Feb","2":"Mar","3":"Apr","4":"May","5":"Jun","6":"Jul","7":"Aug","8":"Sep","9":"Oct","10":"Nov","11":"Dec"};if(/(Y+)/.test(f)){f=f.replace(RegExp.$1,(d.getFullYear()+"").substr(4-RegExp.$1.length))}if(/(E+)/.test(f)){f=f.replace(RegExp.$1,"\u661f\u671f"+week[d.getDay()+""])}if(/(C+)/.test(f)){f=f.replace(RegExp.$1,month[d.getMonth()+""]+"\u6708")}if(/(X+)/.test(f)){f=f.replace(RegExp.$1,em[d.getMonth()]);return f;}for(var k in o){if(new RegExp("("+k+")").test(f)){f=f.replace(RegExp.$1,RegExp.$1.length==1?o[k]:("00"+o[k]).substr((""+o[k]).length))}}return f};
	function wa(b,s){for(var k in s)b.push(" ",k,"=\"",s[k],"\"");}
	function we(b,s){for(var k in s)b.push("<param name='",k,"' value=\"",s[k],"\"/>");}
	w.$hf=function(w,d){
	function cur(){var c=d.body || d.documentElement;for(;;){var l=c.lastChild;if(!l || l.nodeType==3) break;c=l;}for(;;){var l=c.previousSibling;if(l.nodeName.toLowerCase()!="script") return l;c=l;}}
	var h=cur().parentNode;
	var $$=function(i){if(typeof(i)!='string') return i;return d.getElementById(i);};w.$$=$$;
	w.$ls=function(u,sy){var s=d.createElement('script');s.type='text/javascript';if(!sy)s.async=true;s.src=u;h.appendChild(s);}
	w.$ifs=function(o){
		var p=o.parentNode;
		while(p&&p.id.substring(0,3)!="fx_")
			p=p.parentNode;
		if(!p||o.width<=p.clientWidth) return;
		o.style.height=o.height*p.clientWidth/o.width+"px";
		o.style.width=p.clientWidth+"px";
	};

	w.$ba=function(o,e,f){
		if(o.attachEvent)o.attachEvent("on"+e,f);
		else if(o.addEventListener){o.addEventListener(e,f,false);}
	};
	w.$rect=function(){
		var b=(is_ie || is_ff)?d.documentElement:d.body;
		return {x:b.scrollLeft,y:b.scrollTop,h:b.clientHeight,w:b.clientWidth};
	};
	(function(){	
		var f,t;
		$bg=function(i,c){
			var o=$$(i);
			if(!o)
				return;
			var b=d.body || d.documentElement;
			if(c){
				if(!f) f="$bg('"+i+"',true)";
				var v=b.offsetWidth-960;
				o.style.left=(v>0?v:0)/2+"px";
			}
			var r=$rect(),ofh=o.offsetHeight,bsh=b.scrollHeight;
			if(ofh<bsh) o.style.height=bsh;
			if(ofh<r.h) o.style.height="100%";			
		};
		$ba(w,"resize",function(){if(t) w.clearTimeout(t);if(f) t=w.setTimeout(f,10);});
	})();

	w.$d=function(f){
		var p,t,v,e=cur();
		if(!e || !(t=Date.parse(e.innerHTML)))return;
		if(f){t=new Date(t);e.innerHTML=format_date(t,f);return;}
		v=Math.floor((now-t)/1000);
		p=v>0?"前":(v=-v) && "后";
		e.innerHTML=v<10?"现在":v<60?v+"秒"+p:v<3600?Math.floor(v/60)+"分钟"+p:v<43200?Math.floor(v/3600)+"小时"+p:(t=new Date(t)) && (t.getFullYear()+"-"+((t.getMonth()+1)<10?("0"+(t.getMonth()+1)):(t.getMonth()+1))+"-"+(t.getDate()<10?("0"+t.getDate()):t.getDate())+"\xa0"+(t.getHours()<10?("0"+t.getHours()):t.getHours())+":"+(t.getMinutes()<10?("0"+t.getMinutes()):t.getMinutes()));
	};
	w.$O=function(a){a[0]='T:'+a[0];return a;};
	w.$t=function(f,c,x,h,b){var t=h?"a":"span";var s="<"+t+" class='"+c+"'";if(h)s+=" "+(h.indexOf('//')==-1?"href='http://"+(f?"www.":"admin.")+wcs_vars.ms_domain+h:"href='"+h)+"' target='"+(!b?"_self":typeof(b)=='string'?b:'_blank')+"'";return s+">"+x+"</"+t+">";};
	w.$m=function(i){if(is_ie){var e=i?$$(i):cur();var s=e.style;if(is_ie9){s.filter="";return;}s.filter=e.currentStyle.filter.replace("Matrix(","Matrix(SizingMethod='auto expand',");}};
	var empty=wcs_url+"res/html/empty.gif";
	w.$a=function(i,r,a){if(is_ie6||(is_ie&&r)||(is_ie&&a)){var e=i?$$(i):cur();e.style.filter+="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+e.src+"',sizingMethod='"+(i?'scale':'image')+"')";e.src=empty;}};
	w.$p=function(i){if(!is_ie||is_ie9){var s=i?$$(i):cur();for(var o=s.firstChild.nextSibling;o;o=o.nextSibling){o.style.position="relative";}}}
	w.$html=function(i,h){var e=(i?$$(i):cur());if(e)e.innerHTML=h;};
	w.$iframe=function(i,h){(i?$$(i):cur()).contentWindow.document;d.open();d.write(h);d.close();};
	w.$swf=function(i,s,oa,oe,ea,ca,ce){
		var b=[];
		if(is_ie)
		{
			b.push("<object codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,32,18' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' type='application/x-shockwave-flash'");
			wa(b,oa);wa(b,ca);b.push('>');we(b,{movie:s});we(b,oe);we(b,ce);
			b.push("</object>");
		}
		else
		{
			b.push("<embed pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' src=\"",s,"\"");
			wa(b,ea);wa(b,ca);wa(b,oe);wa(b,ce);b.push("></embed>");
		}
		if(i===0)return b.join('');
		if(!i) i=cur();
		i.style.height=i.parentNode.offsetHeight+"px";
		w.$html(i,b.join(''));
	};
	};

	w.$hf(w,d);
	var ur=0,usr;
	var c=d.cookie;
	var ch="wg-sess";if(wcs_vars.dss)ch+="-"+wcs_vars.dss;
	ch+="=";
	var idx=c.indexOf(ch);
	if(idx!=-1)
	{
		idx+=ch.length;
		var eidx=c.indexOf(';',idx);
		sess=c.substring(idx,eidx==-1?c.length:eidx);
		ur=parseInt(sess.substring(13,15),16);	
		var ul=parseInt(sess.substring(45,47),16);
		usr=sess.substring(47,47+ul);
	}
	var si=ur>40;
	var sf=si && wcs_vars && wcs_vars.site_owner==usr;
	wcs_vars.sf=sf;
	var h='{display:none}';
	var css=(si?'.uh':'.gh').concat(h,si?'a.uh':'a.gh',h,sf?'.sh':'.oh',h,sf?'a.sh':'a.oh',h);
	if(is_ie)
	{
		var s=d.styleSheets;
		(s=s[s.length-1]).cssText=css;
	}
	else
	{
		var s=d.getElementsByTagName("style");
		(s=s[s.length-1]).appendChild(d.createTextNode(css));
	}

	w.wcs_run=function(cr){
		if(window.top!=window||wcs_vars.ms_domain=="haoda35.com")
		{
			var o=$$("div_powerbytap");
			if(o)o.style.display="none";
			var o=$$("wcs_pbt_sp");
            if(o)o.style.display="none";
		}
		else if(sf)
		{	
			var o=$$("wcs_pbt_left");
			var flag=false;
			if(!o)
			{
				if(wcs_vars.site_tags&&wcs_vars.site_tags.indexOf("@msite")!=-1&&wcs_vars.site_owner==wcs_vars.site_creator)
				{	
					flag=true;
					var sp=d.createElement('div');
					sp.id="wcs_pbt_sp";
					d.body.appendChild(sp);
					var tap=d.createElement('div');
					tap.id="div_powerbytap";
					var b=[];
					b.push("<div class=\"left\"><img src=\"/res/html/tap.png\"><script>$a();</script><a id=\"power\" class=\"power\" target=\"_blank\" href=\"http://www.haoda35.com\">Powered by haoda35.com</a>");
					b.push("<span id=\"wcs_pbt_left\"></span></div><div onclick=\"$$('wcs_pbt_sp').style.display=$$('div_powerbytap').style.display='none';\" class=\"close\">×</div><div id=\"wcs_pbt_right\" class=\"right\"></div>");
					tap.innerHTML=b.join('');
					d.body.appendChild(tap);
				}
			}
			var slink=biz?"http://biz."+wcs_vars.ms_domain:"/services/";
			if(flag)
			{
				$html('wcs_pbt_left',$t(true,'tip',"您当前账户下的网站，底部栏会自动去除；为方便您管理网站，当自己访问时，底部栏才会出现。",slink,true));
			}
			else
			{
				$html('wcs_pbt_left',$t(true,'tip',"您是Tap免费用户，升级成为"+(wcs_vars.user_type=="1"?"企业会员":"VIP")+"可去除底部栏并享受更多增值服务(包含独立域名绑定)！",slink,true)+$t(true,'update'," >马上升级",slink,true));
			}
			var power=$$('power');
			var icp=$$('icp');
			if(power)
				power.style.display="none";
			if(icp)
				icp.style.display="none";
			$html('wcs_pbt_right',$t(true,'back','欢迎回来'+$t(true,'name',wv.owner,biz?"http://biz."+wcs_vars.ms_domain+"/account/":"/account/"))+$t(true,'btn','站内信',biz?"http://biz."+wcs_vars.ms_domain+"/inbox/":"/inbox/")+$t(true,'access',"访问量: "+(wv.access || 0))+$t(false,'btn','网站后台',"/manage/"+wv.site_id,true)+$t(true,'btn','编辑',(biz?"http://biz."+wcs_vars.ms_domain+"/edit/":"http://www."+wcs_vars.ms_domain+"/edit/")+wv.site_id));
		}
		wcs_url=wv.url;
		wcs_root=wcs_root_host+"res/"+wcs_version+"/";
		wcs_url_ajax_call=wv.url+"c";
		var p="/o/"+wv.site_version;
		var t=(wv.preview?"1":"0")+"/"+wv.site_id+".js";
		$ls(p+"/js-"+wv.source_site_id.substring(5)+wv.page_id+wv.page_frame+"/"+t,true);
		$ls(p+wcs_vars.dct+"/sjs/"+t,true);
		$ls(wcs_root+"wcs.loader/wcs.loader_zh-chs.js.jgz");
	};
	var l=d.location,path=l.href,path=path.substring(path.indexOf('/',10));
	var host=l.host,i=host.indexOf('.'),name=host.substring(0,i),root=host.substring(i+1);
	var c=d.cookie,i=c.indexOf("wg-sess="),acc=i!=-1 && c.substr(i+21,13) || '0000000000000';
	path=path.replace(/^\/(\w+)(\-[0-9a-z]{13}($|\/.*))/,"/$1-object/$1$2");
	if(name!='www'){path='/'+name+path;host='subdomain.'+root;}
	w._gaq=w._gaq || [];
	function bd(i){d.write(unescape("%3Cscript src='http://hm.baidu.com/h.js%3F"+i+"'%3E%3C/script%3E"));}
	function gg(i,d,u){w._gaq.push(['_setAccount','UA-8818248-'+i],['_setDomainName','.'+d],['_setCustomVar',1,'acc',acc,1],['_trackPageview',u]);}
	$ls('http://www.google-analytics.com/ga.js');
	var cfg=({
		'www.tap.cn':['7c1d590fd7ecbe577c59327be24945dd',bd,6,gg],
		'subdomain.tap.cn':['eddf1e2be4422e763134b42221e38ac3',bd,4,gg],
		'www.haoda35.com':['7b3b89f1a70fd3e41994f617dedbf07d',bd,7,gg]
	})[host];
	if(cfg) for(var i=0;i<cfg.length;i+=2) try{cfg[i+1](cfg[i],root,path);}catch(e){}
})();


